package collection

fun main(){
    val colors = listOf("red", "brown", "grey")
    val animal = listOf("fox", "bear", "wolf")
    val groups = colors zip animal
    println(groups)
    val disgroup = groups.unzip()
    println(disgroup.first)
    println(disgroup.second)

    val numbers = listOf("one", "two", "three", "four")
    println(numbers.associateWith { it.length })
    println(numbers.associateBy { it.toUpperCase() })
    println(numbers.associateBy(keySelector = { it.toUpperCase() }, valueTransform = {it.length}))

    val numberSets = listOf(setOf(1, 2, 3), setOf(4, 5, 6), setOf(1, 2))
    println(numberSets.flatten())


    println(numbers.joinToString())

    println(numbers.joinToString(limit = 2, truncated = "<...>"))

    println(numbers.joinToString{it.toUpperCase()})
}